Make filters, shapefile, csv support configurable away at runtime.
Fix several problems with new XML_UNICODE code.
Allow expat library configuration at build time
Allow more custom waypoint icons in Garmin, bring in more category support.
Many fixes to track stat recalculator.
#include "filterdefs.h"
#include "grtcirc.h"
+#if FILTERS_ENABLED
#define MYNAME "Arc filter"
static double pos_dist;
NULL,
arcdist_args
};
+#endif FILTERS_ENABLED
return res;
}
+/*
+ * 'str' points to an array of XML_Chars which may be UNICODE16
+ * words in native endianness.
+ */
-const char *xml_convert_to_char_string(const XML_Char *str)
+const char *xml_convert_to_char_string_n(const XML_Char *src, int *n)
{
#ifdef XML_UNICODE
- return cet_str_uni_to_utf8(str, wcslen(str));
+ char *utf8;
+ char *utf8b;
+ int i, j;
+
+ /*
+ * '*n' is the number of source bytes.
+ * Walk over that, converting each character and
+ * discarding it, but tallying 'i' as the number of
+ * bytes in the destination string.
+ */
+ i = 0;
+ for (j = 0; j < *n; j++) {
+ i += cet_ucs4_to_utf8(NULL, 6, src[j]);
+ }
+
+ /* Update output byte count in caller. */
+ *n = i;
+
+ /* Appropriately size (not zero terminated) buffer */
+ utf8 = utf8b = xmalloc(i);
+
+ for (j = 0; utf8 < utf8b + i; j++) {
+ utf8 += cet_ucs4_to_utf8(utf8, 6, src[j]);
+ }
+
+ return utf8b;
+#else
+ return src;
+#endif
+}
+
+/*
+ * 'str' points to NULL terminated string of XML_Chars which
+ * may be UNICODE16 words in native endianness.
+ */
+
+const char *xml_convert_to_char_string(const XML_Char *src)
+{
+#ifdef XML_UNICODE
+ char *utf8;
+ char *utf8b;
+ int i, j;
+ const XML_Char *in = src;
+
+ /* Walk source array until we find source terminator */
+ i = 0;
+ for (j = 0; src[j]; j++) {
+ i += cet_ucs4_to_utf8(NULL, 6, src[j]);
+ }
+
+ /* We return a NUL terminated string. */
+ utf8 = utf8b = xmalloc(i + 1);
+ in = src;
+
+ for (j = 0; utf8 < utf8b + i; j++) {
+ utf8 += cet_ucs4_to_utf8(utf8, 6, src[j]);
+ }
+ *utf8 = '\0';
+
+ return utf8b;
+
#else
- return str;
+ return src;
#endif
}
+
void xml_free_converted_string(const char *str)
{
#ifdef XML_UNICODE
- xfree(str);
+ xfree((void *) str);
#endif
}
{
#ifdef XML_UNICODE
while (attr != NULL && *attr != NULL) {
- xfree(*attr);
+ xfree((void *)*attr);
++attr;
}
#endif
* it.
*/
+const char *xml_convert_to_char_string_n(const XML_Char *str, int *nbytes);
const char *xml_convert_to_char_string(const XML_Char *str);
void xml_free_converted_string(const char *str);
static void
ce_cdata(void *dta, const XML_Char *xml_s, int len)
{
- const char *s = xml_convert_to_char_string(xml_s);
+ const char *origs = xml_convert_to_char_string_n(xml_s, &len);
+ const char *s = origs;
if (*s != '\n') {
char *edatastr;
// We buffer up characters in 'cdatastr' until a single <lf> is received
cdatastr[0] = '\0';
}
- xml_free_converted_string(s);
+ xml_free_converted_string(origs);
}
/* Set up reading the CE input file */
#include "defs.h"
#include "csv_util.h"
+#if CSVFMTS_ENABLED
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
compegps_args,
CET_CHARSET_MS_ANSI, 1
};
+#endif /* CSVFMTS_ENABLED */
/* 0 for most-used character sets */
#undef CET_WANTED
+/* 1 to enable the CSV formats support */
+#undef CSVFMTS_ENABLED
+
+/* 1 to enable all the filters. */
+#undef FILTERS_ENABLED
+
/* Defined if you have libexpat */
#undef HAVE_LIBEXPAT
esac
cat <<\_ACEOF
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-shapefile=(yes)|no
+ --enable-pdb=(yes)|no
+ --enable-csv=(yes)|no
+ --enable-filters=(yes)|no
+
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
---with-cet=(default,all,minimal)
+ --with-cet=(default,all,minimal)
+ --with-expathdr=DIR Use this to specify the location of expat.h
+ --with-libexpat=DIR Use this to specify expat library .
Some influential environment variables:
CC C compiler command
fi
+echo "$as_me:$LINENO: checking whether to support shapefiles" >&5
+echo $ECHO_N "checking whether to support shapefiles... $ECHO_C" >&6
+# Check whether --enable-shapefile or --disable-shapefile was given.
+if test "${enable_shapefile+set}" = set; then
+ enableval="$enable_shapefile"
+ enable_shapefile="$enableval"
+else
+ enable_shapefile="yes"
+fi;
+ if test "$enable_shapefile" != "no" ; then
cat >>confdefs.h <<\_ACEOF
#define SHAPELIB_ENABLED 1
_ACEOF
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+
+echo "$as_me:$LINENO: checking whether to support Palm/OS pdb formats" >&5
+echo $ECHO_N "checking whether to support Palm/OS pdb formats... $ECHO_C" >&6
+# Check whether --enable-pdb or --disable-pdb was given.
+if test "${enable_pdb+set}" = set; then
+ enableval="$enable_pdb"
+ enable_pdb="$enableval"
+else
+ enable_pdb="yes"
+fi;
+ if test "$enable_pdb" != "no" ; then
cat >>confdefs.h <<\_ACEOF
#define PDBFMTS_ENABLED 1
_ACEOF
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+
+echo "$as_me:$LINENO: checking whether to support csv formats" >&5
+echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6
+# Check whether --enable-csv or --disable-csv was given.
+if test "${enable_csv+set}" = set; then
+ enableval="$enable_csv"
+ enable_csv="$enableval"
+else
+ enable_csv="yes"
+fi;
+ if test "$enable_csv" != "no" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CSVFMTS_ENABLED 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+
+echo "$as_me:$LINENO: checking whether to support csv formats" >&5
+echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6
+# Check whether --enable-filters or --disable-filters was given.
+if test "${enable_filters+set}" = set; then
+ enableval="$enable_filters"
+ enable_filters="$enableval"
+else
+ enable_filters="yes"
+fi;
+ if test "$enable_filters" != "no" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define FILTERS_ENABLED 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+
case "$target" in
*-*-cygwin* | *-*-mingw32*)
echo "$as_me:$LINENO: result: failed" >&5
echo "${ECHO_T}failed" >&6
-echo "$as_me:$LINENO: checking for libexpat" >&5
-echo $ECHO_N "checking for libexpat... $ECHO_C" >&6
-if test "$with_libexpat" = no ; then
- echo "$as_me:$LINENO: result: check not done" >&5
-echo "${ECHO_T}check not done" >&6
+
+# Check whether --with-expathdr or --without-expathdr was given.
+if test "${with_expathdr+set}" = set; then
+ withval="$with_expathdr"
+ xpathdr="$withval"
else
-# Special case fink test.
case "$target" in
*-*-darwin*)
- if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then
- CFLAGS="$CFLAGS -I/sw/include"
- LDFLAGS="$LDFLAGS -L/sw/lib"
- # Static link against expat archive, not dyn lib.
+ if test -f /sw/include/expat.h ; then
+ xpathdr=/sw/include/
+ fi
+ ;;
+ *) ;;
+ esac
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBEXPAT 1
-_ACEOF
+fi;
+
+if test "x-$xpathdr " != "x-" ; then
+ CFLAGS="$CFLAGS -I$xpathdr"
+fi
+
+echo "$as_me:$LINENO: checking for libexpat" >&5
+echo $ECHO_N "checking for libexpat... $ECHO_C" >&6
+
+# Check whether --with-libexpat or --without-libexpat was given.
+if test "${with_libexpat+set}" = set; then
+ withval="$with_libexpat"
+ EXPAT_LIB="-L$withval -lexpat"
+else
+
+ case "$target" in
+ *-*-darwin*)
+ if test -f /sw/lib/libexpat.a ; then
EXPAT_LIB=/sw/lib/libexpat.a
fi
;;
*)
- echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
+ EXPAT_LIB=-lexpat
+ ;;
+ esac
+
+
+fi;
+echo "$as_me:$LINENO: result: $EXPAT_LIB" >&5
+echo "${ECHO_T}$EXPAT_LIB" >&6
+
+echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6
if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
#define HAVE_LIBEXPAT 1
_ACEOF
- EXPAT_LIB="$LDFLAGS -lexpat"
-fi
+# [EXPAT_LIB="$LDFLAGS -lexpat"]
- ;;
- esac
fi
+echo $EXPAT_LIB
# Checks for header files.
# AC_HEADER_STDC
# Checks for libraries.
AC_CHECK_LIB([m], [cos])
-AC_ARG_WITH(cet,[--with-cet=(default,all,minimal)],
+AC_ARG_WITH(cet,[ --with-cet=(default,all,minimal)],
cet="$withval", cet="default")
if test "$cet" = "all"; then
AC_DEFINE(CET_WANTED, 0, [0 for most-used character sets])
fi
-AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
-AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
+AC_MSG_CHECKING(whether to support shapefiles)
+AC_ARG_ENABLE(shapefile,
+ [ --enable-shapefile=[(yes)|no]],
+ [ enable_shapefile="$enableval"],[enable_shapefile="yes"])
+ if test "$enable_shapefile" != "no" ; then
+ AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+AC_MSG_CHECKING(whether to support Palm/OS pdb formats)
+AC_ARG_ENABLE(pdb,
+ [ --enable-pdb=[(yes)|no]],
+ [ enable_pdb="$enableval"],[enable_pdb="yes"])
+ if test "$enable_pdb" != "no" ; then
+ AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+AC_MSG_CHECKING(whether to support csv formats)
+AC_ARG_ENABLE(csv,
+ [ --enable-csv=[(yes)|no]],
+ [ enable_csv="$enableval"],[enable_csv="yes"])
+ if test "$enable_csv" != "no" ; then
+ AC_DEFINE(CSVFMTS_ENABLED, 1, [1 to enable the CSV formats support])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+AC_MSG_CHECKING(whether to support csv formats)
+AC_ARG_ENABLE(filters,
+ [ --enable-filters=[(yes)|no]],
+ [ enable_filters="$enableval"],[enable_filters="yes"])
+ if test "$enable_filters" != "no" ; then
+ AC_DEFINE(FILTERS_ENABLED, 1, [1 to enable all the filters.])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
case "$target" in
*-*-cygwin* | *-*-mingw32*)
AC_MSG_CHECKING(for random stuff to make you feel better)
AC_MSG_RESULT(failed)
-AC_MSG_CHECKING(for libexpat)
-if test "$with_libexpat" = no ; then
- AC_MSG_RESULT(check not done)
-else
+AC_ARG_WITH(expathdr,
+ [ --with-expathdr[=DIR] Use this to specify the location of expat.h],
+ [ xpathdr="$withval" ], [
+ case "$target" in
+ *-*-darwin*)
+ if test -f /sw/include/expat.h ; then
+ xpathdr=/sw/include/
+ fi
+ ;;
+ *) ;;
+ esac
+]
+)
+
+if test "x-$xpathdr " != "x-" ; then
+ CFLAGS="$CFLAGS -I$xpathdr"
+fi
-# Special case fink test.
+AC_MSG_CHECKING(for libexpat)
+AC_ARG_WITH(libexpat,
+ [ --with-libexpat[=DIR] Use this to specify expat library .],
+ [ EXPAT_LIB="-L$withval -lexpat"], [
case "$target" in
*-*-darwin*)
- if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then
- CFLAGS="$CFLAGS -I/sw/include"
- LDFLAGS="$LDFLAGS -L/sw/lib"
- # Static link against expat archive, not dyn lib.
- AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
+ if test -f /sw/lib/libexpat.a ; then
EXPAT_LIB=/sw/lib/libexpat.a
fi
;;
*)
- AC_CHECK_LIB([expat], [XML_ParserCreate],
- AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
- [EXPAT_LIB="$LDFLAGS -lexpat"])
-
+ EXPAT_LIB=-lexpat
;;
esac
-fi
-AC_SUBST(EXPAT_LIB)
+ ]
+)
+AC_MSG_RESULT($EXPAT_LIB)
+
+AC_CHECK_LIB([expat], [XML_ParserCreate],
+ AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
+ AC_SUBST(EXPAT_LIB)
+# [EXPAT_LIB="$LDFLAGS -lexpat"]
+)
+echo $EXPAT_LIB
# Checks for header files.
# AC_HEADER_STDC
return (tmp);
}
+#if CSVFMTS_ENABLED
/*****************************************************************************/
/* dec_to_intdeg() - convert decimal degrees to integer degreees */
/* usage: i = dec_to_intdeg(31.1234, 1); */
return(rval * sign);
}
-
+#endif
/*****************************************************************************
* human_to_dec() - convert a "human-readable" lat and/or lon to decimal
}
}
+#if CSVFMTS_ENABLED
/*
* dec_to_human - convert decimal degrees to human readable
*/
fprintf (xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter);
}
}
-
+#endif
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
static char *hdopopt = NULL;
static char *vdopopt = NULL;
static char *andopt = NULL;
NULL,
fix_args
};
+#endif
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
static char *snopt = NULL;
static char *lcopt = NULL;
static char *purge_duplicates = NULL;
NULL,
dup_args
};
+#endif
static
fl_vecs_t filter_vec_list[] = {
+#if FILTERS_ENABLED
+ {
+ &arcdist_vecs,
+ "arc",
+ "Include Only Points Within Distance of Arc",
+ },
{
- &position_vecs,
- "position",
- "Remove Points Within Distance",
- },
- {
- &radius_vecs,
- "radius",
- "Include Only Points Within Radius",
- },
+ &discard_vecs,
+ "discard",
+ "Remove unreliable points with high hdop or vdop"
+ },
{
&duplicate_vecs,
"duplicate",
"Remove Duplicates",
},
- {
- &arcdist_vecs,
- "arc",
- "Include Only Points Within Distance of Arc",
+ {
+ &interpolatefilt_vecs,
+ "interpolate",
+ "Interpolate between trackpoints"
+ },
+ {
+ &nuke_vecs,
+ "nuketypes",
+ "Remove all waypoints, tracks, or routes"
},
{
&polygon_vecs,
"polygon",
"Include Only Points Inside Polygon",
},
+ {
+ &position_vecs,
+ "position",
+ "Remove Points Within Distance",
+ },
+ {
+ &radius_vecs,
+ "radius",
+ "Include Only Points Within Radius",
+ },
{
&routesimple_vecs,
"simplify",
"Simplify routes",
},
- {
- &reverse_route_vecs,
- "reverse",
- "Reverse stops within routes",
- },
{
&sort_vecs,
"sort",
"stack",
"Save and restore waypoint lists"
},
+ {
+ &reverse_route_vecs,
+ "reverse",
+ "Reverse stops within routes",
+ },
{
&trackfilter_vecs,
"track",
"Manipulate track lists"
},
- {
- &discard_vecs,
- "discard",
- "Remove unreliable points with high hdop or vdop"
- },
- {
- &nuke_vecs,
- "nuketypes",
- "Remove all waypoints, tracks, or routes"
- },
- {
- &interpolatefilt_vecs,
- "interpolate",
- "Interpolate between trackpoints"
- },
+#endif
{
NULL,
NULL,
{ 35, 36, "White Dot" },
{ 88, 8219, "Zoo" },
- /* These are experimental and for the custom icons in the new "C"
- * models. As of this writing, firmware problems impair their
- * general use.
- *
- * "Quest" supports more icons than this, but other problems
- * prohibit us from running with that model, so we stop at 24.
- *
- * Mapsource doesn't yet know how to do these, so we made the icon
- * numbers "-2" to signify that as a problem until we can create
- * these in a .mps or .gdb file and see their representation there.
+ /* Custom icons. The spec reserves 7680-8191 for the custom
+ * icons on the C units, Quest, 27xx, 276, 296, and other units.
+ * Note that firmware problems on the earlier unit result in these
+ * being mangled, so be sure you're on a version from at least
+ * late 2005.
+ * { -2, 7680, "Custom 0" },
+ * ....
+ * { -2, 8192, "Custom 511" },
*/
- { -2, 7680, "Custom 0" },
- { -2, 7681, "Custom 1" },
- { -2, 7682, "Custom 2" },
- { -2, 7683, "Custom 3" },
- { -2, 7684, "Custom 4" },
- { -2, 7685, "Custom 5" },
- { -2, 7686, "Custom 6" },
- { -2, 7687, "Custom 7" },
- { -2, 7688, "Custom 8" },
- { -2, 7689, "Custom 9" },
- { -2, 7690, "Custom 10" },
- { -2, 7691, "Custom 11" },
- { -2, 7692, "Custom 12" },
- { -2, 7693, "Custom 13" },
- { -2, 7694, "Custom 14" },
- { -2, 7695, "Custom 15" },
- { -2, 7696, "Custom 16" },
- { -2, 7697, "Custom 17" },
- { -2, 7698, "Custom 18" },
- { -2, 7699, "Custom 19" },
- { -2, 7700, "Custom 20" },
- { -2, 7701, "Custom 21" },
- { -2, 7702, "Custom 22" },
- { -2, 7703, "Custom 23" },
{ 92, 8227, "Micro-Cache" }, /* icon for "Toll Booth" */
{ 48, 161, "Virtual cache" }, /* icon for "Scenic Area" */
gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic)
{
icon_mapping_t *i;
- char custom[] = "Custom 63";
+ char custom[] = "Custom 63 ";
if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563))
{
return xstrdup(custom);
}
+ if ((garmin_format == PCX) && (icon >= 7680) && (icon <= 8191)) {
+ snprintf(custom, sizeof(custom), "Custom %d", icon - 7680);
+ *dynamic = 1;
+ return xstrdup(custom);
+ }
+
if (dynamic) *dynamic = 0;
for (i = garmin_icon_table; i->icon; i++) {
return n;
}
- if ((garmin_format == GDB) && (case_ignore_strncmp(desc, "Custom ", 7) == 0)) {
- n = atoi((char *)desc + 7);
- if ((n >= 0) && (n <= 63))
- return n+500;
+ if (0 == case_ignore_strncmp(desc, "Custom ", 7)) {
+ int base = 0;
+ if (garmin_format == GDB) base = 500;
+ if (garmin_format == PCX) base = 7680;
+ if (base) {
+ n = atoi(&desc[7]);
+ return n + base;
+ }
}
+
for (i = garmin_icon_table; i->icon; i++) {
if (case_ignore_strcmp(desc,i->icon) == 0) {
switch (garmin_format) {
#include "defs.h"
+#if CSVFMTS_ENABLED
#include <math.h>
#include <time.h>
#include <ctype.h>
fprintf(fout, "%s", (count++ > 0) ? "," : "");
if (c == NULL)
- fprintf(fout, "Category %d", i+1);
+// fprintf(fout, "Category %d", i+1);
+ fprintf(fout, "%s", gps_categories[i]);
else
fprintf(fout, "%s", c);
garmin_txt_args,
CET_CHARSET_MS_ANSI, 0
};
+
+#endif // CSVFMTS_ENABLED
#else /* NO_EXPAT */
static void
-gpx_cdata(void *dta, const XML_Char *s, int len)
+gpx_cdata(void *dta, const XML_Char *xml_el, int len)
{
char *estr;
int *cdatalen;
char **cdata;
xml_tag *tmp_tag;
size_t slen = strlen(cdatastr.mem);
+ const char *s = xml_convert_to_char_string_n(xml_el, &len);
vmem_realloc(&cdatastr, 1 + len + slen);
estr = ((char *) cdatastr.mem) + slen;
memcpy( estr, s, len );
*(estr+len) = '\0';
*cdatalen += len;
+
+ xml_free_converted_string(s);
}
static void
/* This file is machine-generated from the contents of style/ */
/* by mkstyle.sh. Editing it by hand is an exeedingly bad idea. */
+#include "defs.h"
+#if CSVFMTS_ENABLED
static char arc[] =
"# gpsbabel XCSV style file\n"
"#\n"
"IFIELD GEOCACHE_PLACER,\"\",\"%s\"\n"
"IFIELD YYYYMMDD_TIME,\"\",\"%ld\"\n"
;
+static char xmap[] =
+"# gpsbabel XCSV style file\n"
+"#\n"
+"# Format: DeLorme Xmap Conduit\n"
+"# Author: Alex Mottram\n"
+"# Date: 12/09/2002\n"
+"#\n"
+"# \n"
+"# As defined in csv.c/xmap\n"
+"#\n"
+
+"DESCRIPTION DeLorme XMap HH Native .WPT\n"
+"EXTENSION wpt\n"
+
+"#\n"
+"# FILE LAYOUT DEFINITIIONS:\n"
+"#\n"
+"FIELD_DELIMITER COMMASPACE\n"
+"RECORD_DELIMITER NEWLINE\n"
+"BADCHARS COMMA\n"
+
+"PROLOGUE BEGIN SYMBOL\n"
+"EPILOGUE END\n"
+"#\n"
+"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
+"#\n"
+"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD DESCRIPTION, \"\", \"%s\"\n"
+
+"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD DESCRIPTION, \"\", \"%s\"\n"
+;
static char xmap2006[] =
"# gpsbabel XCSV style file\n"
"#\n"
-;
-static char xmap[] =
-"# gpsbabel XCSV style file\n"
-"#\n"
-"# Format: DeLorme Xmap Conduit\n"
-"# Author: Alex Mottram\n"
-"# Date: 12/09/2002\n"
-"#\n"
-"# \n"
-"# As defined in csv.c/xmap\n"
-"#\n"
-
-"DESCRIPTION DeLorme XMap HH Native .WPT\n"
-"EXTENSION wpt\n"
-
-"#\n"
-"# FILE LAYOUT DEFINITIIONS:\n"
-"#\n"
-"FIELD_DELIMITER COMMASPACE\n"
-"RECORD_DELIMITER NEWLINE\n"
-"BADCHARS COMMA\n"
-
-"PROLOGUE BEGIN SYMBOL\n"
-"EPILOGUE END\n"
-"#\n"
-"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
-"#\n"
-"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD DESCRIPTION, \"\", \"%s\"\n"
-
-"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD DESCRIPTION, \"\", \"%s\"\n"
;
static char xmapwpt[] =
"# gpsbabel XCSV style file\n"
"IFIELD IGNORE, \"\", \"%-.31s\"\n"
"IFIELD DESCRIPTION, \"\", \"%-.78s\"\n"
;
-#include "defs.h"
-style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "xmap2006", xmap2006 } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}};
+style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}};
size_t nstyles = 25;
+#else /* CSVFMTS_ENABLED */
+style_vecs_t style_list[] = {{0,0}};
+size_t nstyles = 0;
+#endif /* CSVFMTS_ENABLED */
#include "filterdefs.h"
#include "grtcirc.h"
+#if FILTERS_ENABLED
#define MYNAME "Interpolate filter"
static char *opt_interval = NULL;
NULL,
interpfilt_args
};
+#endif FILTERS_ENABLED
extern int32 gps_error;
extern int32 gps_user;
extern int32 gps_show_bytes;
+extern char gps_categories[16][17];
typedef struct GPS_SPacket
* as of this writing for no data type exposes more than 16 bits in the
* bitmask of categories.
*/
-static char categories[16][17];
+char gps_categories[16][17];
/*
* Read descriptor s into category number N;
*/
*/
if (*s) {
- strncpy(categories[cat_num], s, sizeof (categories[0]));
+ strncpy(gps_categories[cat_num], s, sizeof (gps_categories[0]));
} else {
- snprintf(categories[cat_num], sizeof (categories[0]),
+ snprintf(gps_categories[cat_num], sizeof (gps_categories[0]),
"Category %d", cat_num+1);
}
}
gpsbabel.exe: wintesto.cmd
include ../Makefile
-CFLAGS=-Iinclude -I../coldsync -O $(INHIBIT_USB)
+CFLAGS=-Iinclude -I../coldsync -O $(INHIBIT_USB) $(EXTRA_CFLAGS)
#
# Must define empty (don't comment out the whole line) if you want to
# override INHIBIT_USB from the parent Makefile.
echo "/* by mkstyle.sh. Editing it by hand is an exeedingly bad idea. */"
echo
+echo "#include \"defs.h\""
+echo "#if CSVFMTS_ENABLED"
nstyles="0"
for i in style/*.style
do
echo ";"
nstyles=`expr $nstyles + 1`;
done
-
-echo "#include \"defs.h\""
echo "style_vecs_t style_list[] = {$ALIST {0,0}};"
echo "size_t nstyles = $nstyles;"
+echo "#else /* CSVFMTS_ENABLED */"
+echo "style_vecs_t style_list[] = {{0,0}};"
+echo "size_t nstyles = 0;"
+echo "#endif /* CSVFMTS_ENABLED */"
+
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
#define MYNAME "nukedata"
static char *nukewpts, *nuketrks, *nukertes;
nuke_args
};
+#endif
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
#define MYNAME "Polygon filter"
static char *polyfileopt = NULL;
NULL,
polygon_args
};
+#endif // FILTERS_ENABLED
#include "filterdefs.h"
#include "grtcirc.h"
+#if FILTERS_ENABLED
+
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
NULL,
radius_args
};
+#endif // FILTERS_ENABLED
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
+
#define MYNAME "Route reversal filter"
static
NULL,
reverse_route_args
};
+#endif
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
+
typedef enum {
sm_unknown = 0,
sm_gcid,
NULL,
sort_args
};
+#endif FILTERS_ENABLED
#include "defs.h"
#include "filterdefs.h"
+#if FILTERS_ENABLED
+
#define MYNAME "Stack filter"
static char *opt_push = NULL;
stackfilt_exit,
stackfilt_args
};
+
+#endif // FILTERS_ENABLED
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
*/
-
/*
2005-07-20: implemented interval option from Etienne Tasse
2005-07-26: implemented range option
#include "strptime.h"
#include "grtcirc.h"
+#if FILTERS_ENABLED
#define MYNAME "trackfilter"
#define TRACKFILTER_PACK_OPTION "pack"
};
/******************************************************************************************/
+#endif // FILTERS_ENABLED
static
vecs_t vec_list[] = {
+#if CSVFMTS_ENABLED
/* XCSV must be the first entry in this table. */
{
&xcsv_vecs,
"? Character Separated Values",
NULL
},
+#endif
{
&geo_vecs,
"geo",
"pdb"
},
#endif
+#if CSVFMTS_ENABLED
{
&compegps_vecs,
"compegps",
"CompeGPS data files (.wpt/.trk/.rte)",
NULL
},
+#endif //CSVFMTS_ENABLED
{
&yahoo_vecs,
"yahoo",
"GPS TrackMaker",
"gtm"
},
+#if CSVFMTS_ENABLED
{
&garmin_txt_vecs,
"garmin_txt",
"Garmin MapSource - txt (tab delimited)",
"txt"
},
+#endif // CSVFMTS_ENABLED
{
&axim_gpb_vecs,
"axim_gpb",
char *svecname = strtok(v, ",");
int found = 0;
+ if (vecname == NULL) {
+ fatal("A format name is required.\n");
+ }
+
while (vec->vec) {
arglist_t *ap;
char *res;
#include "defs.h"
#include "csv_util.h"
+#if CSVFMTS_ENABLED
#define MYNAME "XCSV"
#define ISSTOKEN(a,b) (strncmp(a,b, strlen(b)) == 0)
xcsv_args,
CET_CHARSET_ASCII, 0 /* CET-REVIEW */
};
+#else
+void xcsv_read_internal_style(const char *style_buf) {}
+void xcsv_setup_internal_style(const char *style_buf) {}
+#endif //CSVFMTS_ENABLED
xml_cdata(void *dta, const XML_Char *xml_s, int len)
{
char *estr;
- const char *s = xml_convert_to_char_string(xml_s);
+ const char *s = xml_convert_to_char_string_n(xml_s, &len);
vmem_realloc(&cdatastr, 1 + len + strlen(cdatastr.mem));
estr = (char *) cdatastr.mem + strlen(cdatastr.mem);